<template>
  <div>
    <u-timepicker @select="select" :range="true"></u-timepicker>
  		<u-table url="/api.php/main/data" :column="column" ref="table" :fun="handle">
        <template scope="props">
            <tr v-for="item of props.data">
              <td>{{item.appName}}</td>
              <td>{{item.nodeName}}</td>
              <td>{{item.index}}</td>
              <td>{{item.temp}}</td>
              <td>{{item.sd/100}} %</td>
              <td>{{item.time}}</td>
              <td><button @click="del(item.id)">删除</button></td>
            </tr>
        </template>
      </u-table>
  </div>
</template>
<script>
import uTable from '@/vendor/pager/pager.vue';
import uTimepicker from '@/vendor/timepicker/timepicker.vue';

export default{
  components:{
    uTable,uTimepicker
  },
  data:function(){
    return {
      column:['APP名称','节点名称',{title:'序号',sortable:true,'name':'index'},'温度','湿度','上报时间','操作'],
      handle:function(item){
        item.temp=(item.temp/100>30)?'高温':'尚可';
        return item;
      }
    }
  },
  methods:{
    select(a,b){
      console.log(a);
      console.log(b);
    },
    del(id){
      var data=this.$refs.table.getRow('id',id);
      console.log(data);
      this.$refs.table.reload();
    }
  }
}
</script>
<style>
</style>